<template>
  <div class="page">
      <div v-show="this.source=='project'" class="list com-border-top com-border-bottom">
          <ul>
              <li v-for="(index, item) in items" class="com-border-bottom">
                  <a class="touch">
                      <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                      <div class="info">项目<span class="tag tag_1">超级管理员</span></div>
                  </a>
              </li>
          </ul>
      </div>
      <div class="weui-cells weui-cells_checkbox">
         <a class="weui-cell weui-cell_access">
             <label class="weui-check__label" for="ss" >
                 <div class="weui-cell__hd">
                     <input type="checkbox" class="weui-check" name="ss" id="ss"  :checked="isSelectAll"  @change="selectAll($event)">
                     <i class="weui-icon-checked"></i>
                 </div>
             </label>
             <div class="weui-cell__bd">
                 <p>全选</p>
             </div>
         </a>
     </div>
      <div v-show="this.source=='addTeamMember'" class="list com-border-top com-border-bottom">
          <div class="weui-cells weui-cells_checkbox" @click="test">
            <label class="weui-cell weui-check__label">
                <div class="weui-cell__hd">
                    <input type="checkbox" class="weui-check" name="checkbox1" checked="checked">
                    <i class="weui-icon-checked"></i>
                </div>
                <div class="weui-cell__bd">
                  <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                  <div class="info">团队<span class="tag tag_1">超级管理员</span></div>
                </div>
            </label>
          </div>
      </div>



  </div>
    <!-- <div class="page">
        <div class="list com-border-bottom" style="margin: 12px 0;">
            <ul>
                <li class="com-border-bottom">
                    <a class="touch" href="#">
                        <span class="icon"></span>
                        <div class="info">添加成员</div>
                    </a>
                </li>
            </ul>
        </div>
        <div class="list com-border-top com-border-bottom">
            <ul>
                <li class="com-border-bottom">
                    <a class="touch" href="#">
                        <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                        <div class="info">李振鹏<span class="tag tag_1">超级管理员</span></div>
                    </a>
                </li>
                <li class="com-border-bottom">
                    <a class="touch" href="#">
                        <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                        <div class="info">Grace<span class="tag tag_1">管理员</span></div>
                    </a>
                </li>
                <li class="com-border-bottom">
                    <a class="touch" href="#">
                        <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                        <div class="info">Kathle<span class="tag tag_2">组长</span></div>
                    </a>
                </li>
                <li class="com-border-bottom">
                    <a class="touch" href="#">
                        <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                        <div class="info">Judy Thompson</div>
                    </a>
                </li>
                <li class="com-border-bottom">
                    <a class="touch" href="#">
                        <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                        <div class="info">Teresa Rogers</div>
                    </a>
                </li>
                <li class="com-border-bottom">
                    <a class="touch" href="#">
                        <img class="avatar" src="http://sta.doumi.com/cgi/placeholder.php?size=44x44" alt="">
                        <div class="info">蔡胜强<span class="tag tag_3">未注册</span></div>
                    </a>
                </li>
            </ul>
        </div>
    </div> -->
</template>

<script>
    /**
     *  引入工具类库 或 Native API
     *  example : import widget from 'gapi/widget'
     */
    import widget from 'gapi/widget.js'
    import * as util from 'js/util.js'

    /**
     *  引入组件 以及 组件接口(Action)
     *  example : import Somecomponents from 'components/Somecomponents/Somecomponents'
     */

    /**
     *  组件实例对象
     */
    export default {
        components: {

        },
        data: function(){
            return{
                items:{
                    teamid:'',
                    soruce: '',
                }
            }
        },
        vuex: {
            getters: {

            },
            actions: {

            }
        },
        methods: {
            /**
             * 初始化
             * @method init
             * @public
             * @return {Null} void
             */
            init (){
              //获取页面来源
                this.source = util.getUrddataString('source')
                switch (this.source) {
                  case 'project':
                      //从转让项目管理员页面过来 。 多选
                      //call get api :/project/user/getall

                    break;
                  case 'team':

                    break;
                  case 'addTeamMember':

                    break;
                  default:

                }
                const that = this;
                let teamid = util.getUrddataString('teamId')
                that.teamid = teamid;
                that.items.root = 'root'

                $.ajax({
                    type: 'GET',
                    url: 'http://saas-test.doumi.com/sea/api/1.0/client/v1/team/member/list',
                    data: {
                        team_id:teamid,
                        project_id:0,
                        offset:'',
                        rows:''
                    },
                    success: (obj) => {
                        console.log(obj)
                       if(obj.errno == 0){
                            that.items.member_list = obj.data;
                       }
                    },
                    error: (xhr,status) => {
                       console.log(xhr)
                    }
                })


                /*跳转页面去团队设置页*/
                window.setting = () => {
                    let encodeStr = encodeURIComponent(`teamId=${this.teamid}`)
                    location.href = `dmsaas://TeamInfo?urdData=${encodeStr}`
                }
            },
            test (){
              
            },
            /*跳转页面去添加成员页*/
            addMember (){
                let encodeStr = encodeURIComponent(`teamId=${this.teamid}`)
                location.href = `dmsaas://AddMember?urdData=${encodeStr}`
            },
            /*跳转页面去成员信息页*/
            gotoMemberInfo (name,mobile,role,user_id,identity){
                let str = `teamId=${this.teamid}&name=${name}&mobile=${mobile}&role=${role}&user_id=${user_id}&identity=${identity}`
                let encodeStr = encodeURIComponent(str)
                location.href = `dmsaas://MemberInfo?urdData=${encodeStr}`
            }
        },
        created(){

            this.init();

        }

    }


</script>

<!-- CSS 样式 -->
<style src="../../node_modules/weui/dist/style/weui.css"></style>
<style src="../../static/css/common.css"></style>
<style src="../../static/css/user-list.css"></style>
<style >
    .weui-cells{
      margin-top: 0px;
    }
</style>
